import { drawArrow , moveTo, lineTo} from '@/utils/common'

export default class Arrow {
  constructor(fromX, fromY, toX, toY, key) {
    this.fromX = fromX
    this.fromY = fromY
    this.toX = toX
    this.toY = toY
    this.key = key
  }

  draw(ctx) {
    ctx.beginPath()
    ctx.lineWidth = 1 * window.devicePixelRatio
    ctx.strokeStyle = 'black'
    moveTo(ctx, this.fromX, this.fromY)
    lineTo(ctx, this.toX, this.toY)
    ctx.stroke()
    drawArrow(ctx, this.fromX, this.fromY, this.toX, this.toY)
  }
}